#include <bits/stdc++.h>
using namespace std;
int cnt;
char house[510][510];
void search(int x,int y) {
    if (house[x][y]=='*') {
        cout<<x<<y<<" is a wall";
        return;
    }
    if (house[x-1][y]==house[x][y-1]==house[x+1][y]==house[x][y+1]=='*')
    {
        cnt++;
    }
    else
    {
        cout<<x<<","<<y<<" 死了"<<endl;
    }
    
    
}
int main(){
    //Part 1:Inputs
    int x,y;
    char ch;
    cin>>x>>y;
    for (int i=1;i<=x;i++)
    {
        for (int j=1;j<=y;j++)
        {
            cin>>ch;
            if (ch=='\n')
            {
                cin>>ch;
            }
            
            if (ch=='0')
            {
                house[x][y]='0';
                cout<<i<<" "<<j<<":0";
            }
            if (ch=='*')
            {
                house[x][y]='*';
                cout<<i<<" "<<j<<":*";
            }
        }
    }
    //Part 2:Search
    for (int i=1;i<=x;i++)
    {
        for (int j=1;j<=y;j++)
        {
            search(i,j);
        }
    }
    cout<<cnt;
    return 0;
}